let mysqlConnection = require("./mysqlConfig")


module.exports = {
    selectManagerNightMode: function (id) {
        return new Promise((resolve,reject) => {
            let selectManagerNightModeSQL = `select user_nightmode.status from user_nightmode where user_id = ${id}`;
            mysqlConnection.query(selectManagerNightModeSQL, function (error, results) {
                resolve(results);
            })
        })
    },
    updateManagerNightMode: function (managerId, status) {
        return new Promise((resolve,reject) => {        
            let updateManagerNightModeSQL = `UPDATE tasks.manager_nightmode t SET t.status = ${status} WHERE t.manager_id = ${managerId}`
            mysqlConnection.query(updateManagerNightModeSQL, function (error, results) {
                resolve(results);
            })
        })
    }
}